###################################################
# This is quickmatch's Makefile
#
# Compile(Debug): make clean;make
# Compile(Release): make clean;make mode=debug
#
# Author: yue
# Date: 2024-5-1
###################################################


# PATH
SRC_DIR = .
SRC_INC = $(SRC_DIR)/include
DIR_LIB = $(SRC_DIR)/../lib
SRC_LIBS = -lpthread
SRC_CODE = $(SRC_DIR)/log/*.c \
           $(SRC_DIR)/rbt_ex/*.c \
		   $(SRC_DIR)/bitmap/*.c \
	       $(SRC_DIR)/swift/*.c \
		   $(SRC_DIR)/acl/*.c

# OPTIONS
ifeq ($(mode), debug)
	CC = gcc -Wall -ggdb3 -fPIC -shared -fstack-protector-all -Wstack-protector -I$(SRC_INC)
else
	CC = gcc -O3 -fPIC -shared -fstack-protector-all -Wstack-protector -I$(SRC_INC)
endif

# LIB_NAME
LIB_NAME = libacl.so

build:$(LIB_NAME)

$(LIB_NAME):
	@echo "Link all file"
	@$(CC) $(SRC_CODE) $(SRC_LIBS) -o $(DIR_LIB)/$(LIB_NAME)
	@cd $(DIR_LIB); ldd $(LIB_NAME); cd -
